print('Using "for···in":')

for row in range(1, 10):
    for col in range(1, row + 1):
        print('{} * {} = {:<4}'.format(col, row, row * col), end='')
    print('')

print('')
print('=' * 120)
print('')

for row in range(9, 0, -1):
    for col in range(1, row + 1):
        print('{} * {} = {:<4}'.format(col, row, row * col), end='')
    print('')

print('')
print('=' * 120)
print('')

for row in range(1, 10):
    for col in range(9, 0, -1):
        if col <= row:
            print('{} * {} = {:<4}'.format(col, row, row * col), end='')
        else:
            print(' ' * len('{} * {} = {:<4}'.format(col, row, row * col)), end='')
    print('')

print('')
print('=' * 120)
print('')

for row in range(9, 0, -1):
    for col in range(9, 0, -1):
        if col <= row:
            print('{} * {} = {:<4}'.format(col, row, row * col), end='')
        else:
            print(' ' * len('{} * {} = {:<4}'.format(col, row, row * col)), end='')
    print('')

print('')
print('~' * 120)
print('~' * 120)
print('')
print('Using "while":')

row = 0
while (row := row + 1) <= 9:
    col = 0
    while (col := col + 1) <= row:
        print('{} * {} = {:<4}'.format(col, row, row * col), end='')
    print('')

print('')
print('=' * 120)
print('')

row = 10
while (row := row - 1) >= 1:
    col = 0
    while (col := col + 1) <= row:
        print('{} * {} = {:<4}'.format(col, row, row * col), end='')
    print('')

print('')
print('=' * 120)
print('')

row = 0
while (row := row + 1) <= 9:
    col = 10
    while (col := col - 1) >= 1:
        if col <= row:
            print('{} * {} = {:<4}'.format(col, row, row * col), end='')
        else:
            print(' ' * len('{} * {} = {:<4}'.format(col, row, row * col)), end='')
    print('')

print('')
print('=' * 120)
print('')

row = 10
while (row := row - 1) >= 1:
    col = 10
    while (col := col - 1) >= 1:
        if col <= row:
            print('{} * {} = {:<4}'.format(col, row, row * col), end='')
        else:
            print(' ' * len('{} * {} = {:<4}'.format(col, row, row * col)), end='')
    print('')


